//
//  StringWithHeight.m
//  UI_09_自适应高度
//
//  Created by dlios on 15-8-13.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "StringWithHeight.h"

@implementation StringWithHeight
 + (CGFloat)heightWithText:(NSString *)text width:(CGFloat)width font:(UIFont *)font
{
    CGSize size = CGSizeMake(width, 3000);
    CGRect rect = [text boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:font} context:nil];
    return rect.size.height;
}
+ (CGFloat)widthWithText:(NSString *)text height:(CGFloat)height font:(UIFont *)font
{
    CGSize size = CGSizeMake(height, 3000);
    CGRect rect = [text boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:font} context:nil];
    return rect.size.width;
}

@end
